<?php require_once('function/check_login_for_index_function.php'); ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Health Tracker</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Health Tracker">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <style>
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }
    </style>
    <link href="css/bootstrap-responsive.css" rel="stylesheet">
    <link rel="shortcut icon" href="ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
  </head>

  <body>


<?php include_once('nav.php'); ?>
      
    <div class="container">
    <div class="row">
    <div class="span4">
      <h1 style="padding-left: 20px;">Validate</h1>
				<?php 
					if (isset($_GET['user']) && isset($_GET['token'])) {
						$username = $_GET['user'];
						$token = $_GET['token']; 
						$result = User::validate($username, $token);
						if ($result) {
							echo constant("MSG_ACCOUNT_VALIDATED");
						} else {
							echo constant("ERROR_TOKEN_INVALID");
						}
					} else {
						echo constant("MSG_UNAUTHORIZED");
					}
				?>
    </div>
    </div>
    </div> <!-- /container -->
  </body>
</html>